{include file="./public/static/block/member/head.html"}
{include file="./public/static/block/member/header.html"}
{include file="./public/static/block/member/leftNav.html"}
    <!-- 左侧边结束 -->
    <!-- 内容开始 -->
    <div id="content" class="app-content" role="main">
        <div class="app-content-body ">
            <div class="wrapper-md">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="table-responsive">
                            <form action="" method="post" name="addform" id="addform">
                                <table class="table table-bordered table-hover table-striped table_striped table_hover">
                                    <tbody>
                                    <tr class="header">
                                        <td height="23" colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>新增地址</strong></td>
                                    </tr>
                                    
                                    <tr>
                                        <td align="center">姓名:</td>
                                        <td><input name="realname" placeholder="情输入姓名" type="text" id="addressname" class="form-control truename" value="{$address.realname}" size="42"></td>
                                    </tr>
                                    <tr>
                                        <td align="center">邮箱地址:</td>
                                        <td><input name="mail" type="text" placeholder="请输入邮箱" class="form-control email" id="truename" value="{$address.mail}" size="42"></td>
                                    </tr>
                                    <tr>
                                        <td align="center">固定电话:</td>
                                        <td><input name="telephone" type="text" placeholder="请输入固定电话 如029-1234567" class="form-control mycall" id="truename" value="{$address.telephone}" size="42"></td>
                                    </tr>
                                    <tr>
                                        <td align="center">手机号码:</td>
                                        <td><input name="mobile" type="text" placeholder="请输入手机号码" class="form-control phone" id="mycall" value="{$address.mobile}" size="42"></td>

                                    </tr>
                                    <tr>
                                        <td align="center">收货地址:</td>
                                        <td> <input name="address" type="text" placeholder="请输入收货地址" class="form-control address" id="phone" value="{$address.address}" size="42"></td>

                                    </tr>
                                    <tr>
                                        <td align="center">邮编:</td>
                                        <td><input name="addressnum" type="text" placeholder="请输入邮编" class="form-control zip" id="address" value="{$address.addressnum}" size="42"></td>

                                    </tr>
                                    <tr>
                                        <td align="center">&nbsp;</td>
                                        <td><input type="submit"  value="提交" class="btn btn-primary addr-btn">
                                            &nbsp;
                                            <input type="reset"  value="重置" class="btn btn-primary reset-addr-btn">
                                            
                                    </tr>
                                    <tr>
                                        <td colspan="2"><p class="w-addr-confirm" style="color:red;text-align: center"></p></td>
                                    </tr>
                                    </tbody>
                                </table>

                            </form>


                            <script>
                                //验证地址名称
                                $('.addressname').blur(function(){
                                    var _val=$(this).val();
                                    if($.trim(_val)==''){
                                        $('.w-addr-confirm').text('地址名称不能为空!');
                                        return false;
                                    }
                                }).focus(function(){
                                    $('.w-addr-confirm').text('');
                                });
                                //验证姓名
                                $('.truename').blur(function(){
                                    var _val=$(this).val();
                                    if($.trim(_val)==''){
                                        $('.w-addr-confirm').text('姓名不能为空!');
                                        return false;
                                    }
                                }).focus(function(){
                                    $('.w-addr-confirm').text('');
                                });
                                //验证邮箱地址 email
                                $('.email').blur(function(){
                                    var _val=$(this).val();
                                    if($.trim(_val)==''){
                                        $('.w-addr-confirm').text('邮箱地址不能为空!');
                                        return false;
                                    }
                                    var reg=/^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/;
                                    if(!reg.test(_val)){
                                        $('.w-addr-confirm').text('邮箱地址不正确!');
                                        return false;
                                    }
                                }).focus(function(){
                                    $('.w-addr-confirm').text('');
                                });
                                $('.mycall').blur(function(){
                                    var _val=$(this).val();
                                    var reg= /^(([0-9]\d{2,3})-)(\d{7,8})(-(\d{3,}))?$/;
                                    if($.trim(_val)!=''){
                                        if(!reg.test(_val)){
                                            $('.w-addr-confirm').text('固定电话号码不正确');
                                        }else{
                                            return true;
                                        }
                                    }
                                }).focus(function(){
                                    $('.w-addr-confirm').text('');
                                });
                                //验证手机号码
                                $('.phone').blur(function(){
                                    var _val=$(this).val();
                                    if($.trim(_val)==''){
                                        $('.w-addr-confirm').text('手机号码不能为空!');
                                        return false;
                                    }
                                    var reg=/^1(3|4|5|7|8)\d{9}$/;
                                    if(!reg.test(_val)){
                                        $('.w-addr-confirm').text('手机号码不正确!');
                                        return false;
                                    }
                                }).focus(function(){
                                    $('.w-addr-confirm').text('');
                                });
                                //验证收货地址
                                $('.address').blur(function(){
                                    var _val=$(this).val();
                                    if($.trim(_val)==''){
                                        $('.w-addr-confirm').text('收货地址不能为空!');
                                        return false;
                                    }
                                }).focus(function(){
                                    $('.w-addr-confirm').text('');
                                });
                                //验证邮编
                                $('.zip').blur(function(){
                                    var _val=$(this).val();
                                    if($.trim(_val)==''){
                                        $('.w-addr-confirm').text('邮编不能为空!');
                                        return false;
                                    }
                                    var reg=/^[0-9][0-9]{5}$/;
                                    if(!reg.test(_val)){
                                        $('.w-addr-confirm').text('邮编不正确!');
                                        return false;
                                    }
                                }).focus(function(){
                                    $('.w-addr-confirm').text('');
                                });

                                $('.addr-btn').on('click',function(){
                                    $('.zip').blur();
                                    $('.address').blur();
                                    $('.phone').blur();
                                    $('.mycall').blur();
                                    $('.email').blur();
                                    $('.truename').blur();
                                    $('.addressname').blur();
                                    if($('.w-addr-confirm').text()==''){
                                        //提交成功 上传数据

                                        return true;
                                    }
                                    return false;
                                });


                            </script>

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- 内容结束 -->
    <!-- 底部开始 -->
{include file="./public/static/block/member/foot.html"}
